package com.scott.ch050;

import redis.clients.jedis.Jedis;

import java.util.Set;

/**
 * @author 黄后林
 * @version 1.0
 * @note
 * @date 2022-03-25 14:18:19
 */
public class RedisSet {

    public static void main(String[] args) {

        Jedis jedis = new Jedis("192.168.88.129", 6379);

        jedis.del("ages");

        //往集合中增加元素
        jedis.sadd("ages","20","40","60","80");

        //得到集合中的所有元素
        Set<String> ages = jedis.smembers("ages");
        System.out.println(ages);

        //删除集合"ages"中的元素"60"
        jedis.srem("ages","60");
        System.out.println(jedis.smembers("ages"));
        jedis.close();
    }
}
